Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add lightclient module and migrate block header state in this module #1976

Merged
merged 66 commits into from
Apr 18, 2024

Conversation

lumtis
Copy link
Member

@lumtis lumtis commented Apr 2, 2024

Description

  • Initialize lightclient module to offload the block header data currently in observer there
  • Rename BlockHeaderState into ChainState to avoid confusion with "having the state of a block header" since this represents the overall state for block headers for a specific chains
  • Move the verification flags values from crosschainFlags to verificationFlags part of the lightclient module state
  • Rename AddBlockHeader in VoteBlockHeader for observer
  • Move verification and block adding logic from VoteBlockHeader to the lightclient module
  • Message to update VerificationFlags
  • Unit tests
  • add breaking changes notice

NOTE: I didn't include a migration script. Currently the block headers features is disabled on live networks. Introducing this module will simply set the state at 0. Including a migration script would introduce risks without benefits as there is no block headers for mainnet

Closes: #1491 #1975

Copy link

codecov bot commented Apr 2, 2024

Codecov Report

Attention: Patch coverage is 86.39175% with 66 lines in your changes are missing coverage. Please review.

Project coverage is 71.11%. Comparing base (8ffbf76) to head (c3f0fe6).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1976      +/-   ##
===========================================
+ Coverage    70.01%   71.11%   +1.09%     
===========================================
  Files          235      245      +10     
  Lines        13477    13643     +166     
===========================================
+ Hits          9436     9702     +266     
+ Misses        3589     3495      -94     
+ Partials       452      446       -6     
Files Coverage Δ
x/crosschain/keeper/grpc_query_cctx.go 86.95% <100.00%> (ø)
x/crosschain/keeper/out_tx_tracker.go 100.00% <ø> (ø)
x/crosschain/types/authz.go 100.00% <100.00%> (ø)
x/lightclient/genesis.go 100.00% <100.00%> (ø)
x/lightclient/keeper/chain_state.go 100.00% <100.00%> (ø)
x/lightclient/keeper/grpc_query_block_header.go 82.60% <100.00%> (ø)
x/lightclient/keeper/grpc_query_prove.go 68.57% <ø> (ø)
...ightclient/keeper/grpc_query_verification_flags.go 100.00% <100.00%> (ø)
...ent/keeper/msg_server_update_verification_flags.go 100.00% <100.00%> (ø)
x/lightclient/keeper/proof.go 100.00% <100.00%> (ø)
... and 21 more

@lumtis
Copy link
Member Author

lumtis commented Apr 2, 2024

Will wait on #1961 to be merged as it will have some conflicts with the tests

e2e/utils/zetacore.go Outdated Show resolved Hide resolved
Copy link

!!!WARNING!!!
nosec detected in the following files: cmd/zetae2e/run.go, zetaclient/evm/evm_client.go

Be very careful about using #nosec in code. It can be a quick way to suppress security warnings and move forward with development, it should be employed with caution. Suppressing warnings with #nosec can hide potentially serious vulnerabilities. Only use #nosec when you're absolutely certain that the security issue is either a false positive or has been mitigated in another way.

Only suppress a single rule (or a specific set of rules) within a section of code, while continuing to scan for other problems. To do this, you can list the rule(s) to be suppressed within the #nosec annotation, e.g: /* #nosec G401 */ or //#nosec G201 G202 G203
Broad #nosec annotations should be avoided, as they can hide other vulnerabilities. The CI will block you from merging this PR until you remove #nosec annotations that do not target specific rules.

Pay extra attention to the way #nosec is being used in the files listed above.

@github-actions github-actions bot added the nosec label Apr 17, 2024
@lumtis lumtis requested a review from kingpinXD April 17, 2024 11:44
@lumtis lumtis merged commit 583bfaf into develop Apr 18, 2024
16 checks passed
@lumtis lumtis deleted the feat/init-lightclient branch April 18, 2024 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants